import Vue from "vue";

//导入第三方模块
import "normalize.css/normalize.css"; // A modern alternative to CSS resets
//导入ELementUI整个组件
import ElementUI from "element-ui";
//导入ElementUI整个组建的样式
import "element-ui/lib/theme-chalk/index.css";
//导入ElementUI的英文语言包
import locale from "element-ui/lib/locale/lang/en"; // lang i18n
// 导入自己的文件
import "@/styles/index.scss"; // global css
// 导入项目根组件
import App from "./App";
// 导入store实例
import store from "./store";
// 导入router实例
import router from "./router";
// 导入字体图标
import "@/icons"; // icon
// 导入权限控制文件
import "@/permission"; // permission control

// 导入自定义指令
import "@/directive";

import customEN from "./lang/en";
import customZH from "./lang/zh";
import Lang from "@/components/Lang";
import PageHerder from "@/components/PageHeader";
import UploadExcel from "@/components/UploadExcel";
import UploadImg from "@/components/UploadImg";
import Print from "vue-print-nb";
import elementEN from "element-ui/lib/locale/lang/en";
import elementZH from "element-ui/lib/locale/lang/zh-CN";
// import ScreenFull from "@/components/ScreenFull";
import ThemePicker from "@/components/ThemePicker";
Vue.prototype.$checkPermission = function (key) {
  // 拿到points中的数组
  const { points } = store.state.user.userInfo.roles;
  // 判断当前传入的权限点在不在内
  return points.includes(key);
};

Vue.use(Print);
Vue.component(Lang.name, Lang);
Vue.component(ThemePicker.name, ThemePicker);
// Vue.component(ScreenFull.name, ScreenFull);
Vue.component(UploadImg.name, UploadImg);
Vue.component(PageHerder.name, PageHerder);
Vue.component(UploadExcel.name, UploadExcel);
// 注册ElemetUI的全部组件 并提供英文语言
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale });
Vue.use(ElementUI);
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

Vue.config.productionTip = false;

import VueI18n from "vue-i18n";
Vue.use(VueI18n);
// 定义规则
const messages = {
  en: {
    ...elementEN,
    ...customEN,
  },
  zh: {
    ...elementZH,
    ...customZH,
  },
};
const i18n = new VueI18n({
  locale: "zh",
  messages,
});
// 实例化vm实例
new Vue({
  el: "#app",
  router,
  store,
  i18n, //提供全局$t方法    进行语言的翻译
  render: (h) => h(App),
}).$mount("#app");

// nvm切换node版本
// 1.全局安装
// npm i nvm -g
// 2.查看node版本 nvm ls
